
function init(){
	$("#grid").kendoGrid({
	     dataSource: {
	         type: "json",
	         transport: {
	        	 read: {
	                 url: urlSearch,
	                 dataType: "json",
	                 type: "get",
	                 data : {}
	             },
	         },
	         //pageSize: 10,
	         schema:{
		        data: "list",
		        total: function(data) {
	                return data.total;
	            },
	    	 },
	    	 aggregate: [
                    { field: "buyItemCoin", aggregate: "sum"},
                    { field: "buySetItemCoin", aggregate: "sum"},
                    { field: "playGachaCoin", aggregate: "sum"},
                    { field: "totalCoin", aggregate: "sum"}
	    	 ],
	    	 requestStart: function(e) {   
                e.sender.transport.options.read.data = utils.getParamsForSearch("frmSearch");
             },
    	     pageSize: 20,
    	     serverPaging: true,
	     },	    
	     sortable: false,         
         groupable: false,
         pageable: {
             refresh: true,
             //pageSizes: true,
         },
	     columns: [{
	    	 title: "Date",
	         field: "dateValue",
	         width: 120,
	         footerTemplate: "<div class='number'>Total:</div>",
	     },{
	         field: "buyItemCoin",
	         title: "Buy Item Coin",
	         format: "{0:n0}",
	         attributes:{class:"number"},
	         width: 120,
	         footerTemplate: "<div class='number'>#=kendo.toString(sum, 'n0')#</div>",
	     }, {
	    	 field: "buySetItemCoin",
	    	 title: "Buy SetItem Coin",
	    	 format: "{0:n0}",
	    	 attributes:{class:"number"},
	         width: 140,
	         footerTemplate: "<div class='number'>#=kendo.toString(sum, 'n0')#</div>",
	     }, {
	    	 field: "playGachaCoin",
	    	 title: "Play Gacha Coin",
	    	 format: "{0:n0}",
	    	 attributes:{class:"number"},
	         width: 130,
	         footerTemplate: "<div class='number'>#=kendo.toString(sum, 'n0')#</div>",
	     },{
	         field: "totalCoin",
	         title: "Total Coin",
	         format: "{0:n0}",
	         attributes:{class:"number"},
	         width: 120,
	         footerTemplate: "<div class='number'>#=kendo.toString(sum, 'n0')#</div>",
	     },{
	         field: "",
	         title: "",
	     }], 
	     dataBound : function(e){
	     }
	});
}

function setAutoRefreshGrid(second)
{
	if(typeof(second) == "undefined")
		second = 10;
		
	setInterval(function(){
		$("#grid").data("kendoGrid").dataSource.read();
	}, second * 1000);
}

function search(){
	$("#grid").data("kendoGrid").dataSource.read();	// Reset grid
}